package SpringFramework.条件注解;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import SpringFramework.条件注解.config.JavaConfig;
import SpringFramework.条件注解.service.ICmd;


public class Main {

	public static void main(String[] args) {
		AnnotationConfigApplicationContext context = null;
		try {
			// 使用AnnotationConfigApplicationContext作为Spring容器，接受输入一个配置类作为参数。
			context = new AnnotationConfigApplicationContext(JavaConfig.class);
			
			ICmd cmd = context.getBean(ICmd.class);
			System.out.println(context.getEnvironment().getProperty("os.name")
					+ "系统下的列表命令："
					+ cmd.showListCmd()
					);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
	}

}
